/**
 * created by 小卷毛, 2019/10/23
 * Copyright (c) 2019, 416143467@qq.com All Rights Reserved.
 * #                   *********                            #
 * #                  ************                          #
 * #                  *************                         #
 * #                 **  ***********                        #
 * #                ***  ****** *****                       #
 * #                *** *******   ****                      #
 * #               ***  ********** ****                     #
 * #              ****  *********** ****                    #
 * #            *****   ***********  *****                  #
 * #           ******   *** ********   *****                #
 * #           *****   ***   ********   ******              #
 * #          ******   ***  ***********   ******            #
 * #         ******   **** **************  ******           #
 * #        *******  ********************* *******          #
 * #        *******  ******************************         #
 * #       *******  ****** ***************** *******        #
 * #       *******  ****** ****** *********   ******        #
 * #       *******    **  ******   ******     ******        #
 * #       *******        ******    *****     *****         #
 * #        ******        *****     *****     ****          #
 * #         *****        ****      *****     ***           #
 * #          *****       ***        ***      *             #
 * #            **       ****        ****                   #
 */
package com.chuanjiabao.wisdom.util

/**
 * 项目名称：chuanjiabao_android
 * 创建人：41614
 * 创建时间：2019-10-23 21:38
 */
object StringHelper {

    @JvmStatic
    fun isParent(name: String): Boolean {
        return "爸爸" in name || "妈妈" in name || "父亲" in name || "母亲" in name
    }

    /**
     * 处理手机联系人亲属关系
     */
    @JvmStatic
    fun isRelative(string: String): Boolean {
        val nameList = listOf(
                "祖父", "祖母", "外祖母", "外祖父", "外公", "外婆",
                "姥姥", "姥爷", "爷爷", "奶奶", "爸爸", "妈妈", "老公", "老婆",
                "父亲", "母亲", "媳妇", "叔叔", "伯伯", "婶婶", "叔父", "叔母",
                "舅舅", "舅妈", "姑父", "姑姑", "侄子", "外甥", "外甥女",
                "闺女", "女儿", "儿子", "哥哥", "姐姐", "弟弟", "妹妹",
                "大叔", "二叔", "三叔", "四叔", "五叔", "小叔",
                "大伯", "二伯", "三伯", "四伯", "五伯", "小伯",
                "大妈", "二妈", "三妈", "四妈", "五妈", "小妈", "老妈",
                "姑父", "大姑父", "二姑父", "三姑父", "四姑父", "五姑父", "小姑父", "老姑父",
                "姑妈", "大姑妈", "二姑妈", "三姑妈", "四姑妈", "五姑妈", "小姑妈", "老姑",
                "大舅", "二舅", "三舅", "四舅", "五舅", "小舅", "老舅",
                "大舅妈", "二舅妈", "三舅妈", "四舅妈", "五舅妈", "小舅妈",
                "姨父", "大姨父", "二姨父", "三姨父", "四姨父", "五姨父", "小姨父", "老姨父",
                "姨妈", "大姨妈", "二姨妈", "三姨妈", "四姨妈", "五姨妈", "小姨妈", "小姨", "老姨"
        )
        return string in nameList
    }

    @JvmStatic
    fun returnSex(str: String): String {
        val nameMale = listOf(
                "祖父", "外祖父", "外公", "姥爷", "爷爷", "爸爸",
                "父亲", "叔叔", "伯伯", "叔父", "舅舅", "姑父",
                "老公", "侄子", "外甥", "儿子", "哥哥", "弟弟",
                "大叔", "二叔", "三叔", "四叔", "五叔", "小叔",
                "大伯", "二伯", "三伯", "四伯", "五伯", "小伯",
                "姑父", "大姑父", "二姑父", "三姑父", "四姑父", "五姑父", "小姑父", "老姑父",
                "大舅", "二舅", "三舅", "四舅", "五舅", "小舅", "老舅",
                "姨父", "大姨父", "二姨父", "三姨父", "四姨父", "五姨父", "小姨父", "老姨父"
        )
        val nameFemale = listOf(
                "祖母", "外祖母", "外婆", "姥姥", "奶奶", "妈妈",
                "母亲", "婶婶", "叔母", "舅妈", "姑姑", "外甥女",
                "老婆", "媳妇", "闺女", "女儿", "姐姐", "妹妹",
                "大妈", "二妈", "三妈", "四妈", "五妈", "小妈", "老妈",
                "姑妈", "大姑妈", "二姑妈", "三姑妈", "四姑妈", "五姑妈", "小姑妈", "老姑",
                "大舅妈", "二舅妈", "三舅妈", "四舅妈", "五舅妈", "小舅妈",
                "姨妈", "大姨妈", "二姨妈", "三姨妈", "四姨妈", "五姨妈", "小姨妈", "小姨", "老姨"
        )

        return when (str) {
            in nameFemale -> "女"
            in nameMale -> "男"
            else -> ""
        }
    }

    @JvmStatic
    fun returnRelativeStr(name: String): String {
        return when {
            "哥" in name -> "哥"
            "弟" in name -> "弟"
            "妹" in name -> "妹"
            "姑" in name -> "姑"
            "父" in name -> "父"
            "母" in name -> "母"
            "爸" in name -> "爸"
            "妈" in name -> "妈"
            "爷" in name -> "爷"
            "奶" in name -> "奶"
            "婶" in name -> "婶"
            "婆" in name -> "婆"
            "舅" in name -> "舅"
            "儿" in name -> "儿"
            "侄" in name -> "侄"
            "姐" in name -> "姐"
            else -> name.substring(0, 1)
        }
    }

}